<?PHP
/* Copyright 2012-2023, Aming International.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2,
 * as published by the Free Software Foundation.
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * Plugin development contribution by Aming
 *
 * Version log:
 * Version 1.9   Modified by Aming       - 添加日志系统
 */
?>
<?
$plugin = "dynamix.system.autofan";

$log_path = dirname(__DIR__).'/scripts/autofan.log';

try {
    if (!file_exists($log_path)) {
        throw new Exception("日志文件不存在");
    }
    
    if (!is_writable($log_path)) {
        throw new Exception("日志文件不可写");
    }
    
    if (file_put_contents($log_path, '') === false) {
        throw new Exception("清空操作失败");
    }
    
    // 保留文件头（如果需要）
    // file_put_contents($log_path, "[".date('Y-m-d H:i:s')."] 日志已重置\n");
    
    echo 'success';
} catch (Exception $e) {
    http_response_code(500);
    echo htmlspecialchars($e->getMessage());
}
?>